import json

# 读取原始 JSON 文件
file_path = r"D:\subtitle\goods\goods_4.json"

with open(file_path, "r", encoding="utf-8") as f:
    data = json.load(f)  # 读取并解析为列表形式

# 分割列表为两个部分
half = len(data) // 2
data_part_1 = data[:half]  # 前 10 个
data_part_2 = data[half:]  # 后 10 个

# 保存第一个新文件
with open(r"D:\subtitle\goods\goods_part_7.json", "w", encoding="utf-8") as f1:
    json.dump(data_part_1, f1, ensure_ascii=False, indent=4)

# 保存第二个新文件
with open(r"D:\subtitle\goods\goods_part_8.json", "w", encoding="utf-8") as f2:
    json.dump(data_part_2, f2, ensure_ascii=False, indent=4)
